<template>
  <div class="unitFile">
    <div class="searchDiv">
      <Form :model="searchItem" :label-width="80">
        <Row :gutter="10">
           <Col span="6">
            <FormItem label="电站">
              <Select v-model="searchItem.powerStation" clearable filterable @on-change="getHd">
                <Option
                  v-for="(item, index) in powerStationList"
                  :value="item"
                  :key="index"
                >{{ item }}</Option>
              </Select>
            </FormItem>
          </Col>
          <Col span="6">
            <FormItem label="HD编号">
              <Select
                v-model="searchItem.hdNumber"
                clearable
                filterable
                :disabled="HBnumberList.length == 0"
                @on-change="getJz"
              >
                <Option v-for="(item, index) in HBnumberList" :value="item" :key="index">{{ item }}</Option>
              </Select>
            </FormItem>
          </Col>
          <Col span="6">
            <FormItem label="机组编号">
              <Select
                v-model="searchItem.aircrewNumber"
                clearable
                filterable
                :disabled="JZnumberList.length == 0"
              >
                <Option v-for="(item, index) in JZnumberList" :value="item" :key="index">{{ item }}</Option>
              </Select>
            </FormItem>
          </Col>
          <Col span="6">
            <FormItem label="型号">
              <Input v-model="searchItem.type" placeholder="请输入"></Input>
              <!--
              <Select v-model="searchItem.type">
                <Option value="1">全部</Option>
                <Option value="2">测试</Option>
              </Select>
              -->
            </FormItem>
          </Col>
          <Col span="6">
            <FormItem label="功率">
              <Input v-model="searchItem.gonglv" placeholder="请输入"></Input>
            </FormItem>
          </Col>
          <Col span="6">
            <FormItem label="投用日期">
              <DatePicker
                type="datetimerange"
                @on-change="time"
                format="yyyy-MM-dd"

                placeholder="Select date"
                style="width: 100%"
              ></DatePicker>
            </FormItem>
          </Col>
          <Col span="12">
            <Button type="primary" class="marRight" @click="pageNo=1;getDataList()">查询</Button>
            <Button type="success" class="marRight" @click="addData">新增机组档案</Button>
            <!-- <Button type="primary" @click="download">导出Excel</Button> -->
          </Col>
        </Row>
      </Form>
    </div>
    <Table  border :columns="columns" :loading="loading" :data="tableData"></Table>
    <!-- 新增弹窗开始 -->
    <Modal :mask-closable="false" v-model="modal1" :title="title1" width="800">
      <div class="baseTitle">设备基本信息</div>
           <Form :label-width="120">
             <Row :gutter="10" class="xzjz">
                 <Col span="8">
                    <FormItem :model="formItem" label="电站：">
                       <Input v-model="formItem.powerStation" disabled placeholder="请输入"></Input>
                      <!-- <Select :disabled="editState" v-model="formItem.powerStation" clearable filterable>
                        <Option v-for="(item, index) in powerStationList" :value="item.displayName" :key="index">{{item.displayName}}</Option>
                    </Select> -->
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="HD编号：">
                       <Input v-model="formItem.hdNumber" disabled placeholder="请输入"></Input>
                      <!-- <Select :disabled="editState" v-model="formItem.hdNumber" clearable filterable>
                        <Option v-for="(item, index) in HBnumberList" :value="item.displayName" :key="index">{{item.displayName}}</Option>
                    </Select> -->
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="机组编号：">
                       <Input v-model="formItem.aircrewNumber" disabled placeholder="请输入"></Input>
                      <!-- <Select :disabled="editState" v-model="formItem.aircrewNumber" clearable filterable>
                          <Option v-for="(item, index) in JZnumberList" :value="item.displayName" :key="index">{{item.displayName}}</Option>
                      </Select> -->
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="型号：">
                      <Input v-model="formItem.type" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="功率：">
                      <Input v-model="formItem.gonglv" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="投用日期：">
                      <DatePicker
                      type="date"
                      format="yyyy-MM-dd"
                      @on-change="time1"
                      v-model="formItem.tyDate"
                      placeholder="Select date"
                      style="width: 100%"
                    ></DatePicker>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="柴油机型号：">
                      <Input v-model="formItem.cyjType" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="柴油机序列号：">
                      <Input v-model="formItem.cyjCode" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="柴油机出厂日期：">
                      <DatePicker
                      @on-change="time2"
                      type="date"
                      format="yyyy-MM-dd"
                      v-model="formItem.cyjDate"
                      placeholder="Select date"
                      style="width: 100%"
                    ></DatePicker>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="柴油机生产厂家：">
                      <Input v-model="formItem.cyjsccj" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="发电机型号：">
                      <Input v-model="formItem.fdjType" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="发电机序列号：">
                      <Input v-model="formItem.fdjCode" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="发电机出厂日期：">
                      <DatePicker
                      @on-change="time3"
                      type="date"
                      format="yyyy-MM-dd"
                      v-model="formItem.fdjDate"
                      placeholder="Select date"
                      style="width: 100%"
                    ></DatePicker>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="发电机生产厂家：">
                      <Input v-model="formItem.fdjscch" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="管理人员：">
                      <Input v-model="formItem.admin" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
             </Row>
           </Form>
           <div class="baseTitle">设备技术参数</div>
           <Form :label-width="120">
             <Row :gutter="10" class="xzjz">
                 <Col span="8">
                    <FormItem label="汽缸数量：">
                      <Input v-model="formItem.qigang" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="缸径/行程：">
                     <Input v-model="formItem.gangjing" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="汽缸工作容积：">
                      <Input v-model="formItem.rongji" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="压缩比：">
                      <Input v-model="formItem.yasuobi" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="额定功率：">
                      <Input v-model="formItem.edgl" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="备用功率：">
                      <Input v-model="formItem.bygl" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="有效功率：">
                      <Input v-model="formItem.yxgl" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="有效转矩：">
                      <Input v-model="formItem.yxzj" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="额定转速：">
                      <Input v-model="formItem.edzs" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="燃油消耗(g/Kw.h)：">
                      <Input v-model="formItem.ryxh" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="机油消耗(g/Kw.h)：">
                     <Input v-model="formItem.jyxh" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="防护等级：">
                      <Input v-model="formItem.fhdj" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="绝缘等级：">
                      <Input v-model="formItem.jydj" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="机组重量：">
                      <Input v-model="formItem.zjzl" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="机组外形尺寸：">
                      <Input v-model="formItem.jzwxcc" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="启动方式：">
                      <Input v-model="formItem.qdfs" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="冷却方式：">
                      <Input v-model="formItem.lxfs" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="监测方式：">
                      <Select v-model="formItem.monitorWay" placeholder="请选择">
                          <!-- <Option :value="1">全部</Option> -->
                          <Option :value="2">手动</Option>
                          <Option :value="3">自动</Option>
                      </Select>
                    </FormItem>
                  </Col>
                  <!-- <Col span="8">
                    <FormItem label="设备唯一标识：">
                      <Input v-model="formItem.equipmentUuid" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="设备ID：">
                      <Input v-model="formItem.equipmentId" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="设备显示名称：">
                      <Input v-model="formItem.equipmentName" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="设备类型编码：">
                      <Input v-model="formItem.equipmentType" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="设备类型名称：">
                      <Input v-model="formItem.equipmentTypeName" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="设备资产编码：">
                      <Input v-model="formItem.erpcode" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>

                  <Col span="8">
                    <FormItem label="设备状态编码：">
                      <Input v-model="formItem.alarmStatus" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="设备状态描述：">
                      <Input v-model="formItem.alarmAlias" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="报警ID：">
                      <Input v-model="formItem.alarmId" placeholder="请输入"></Input>
                    </FormItem>
                  </Col> -->
             </Row>
           </Form>
           <div slot="footer">
               <Button @click="modal1=false">取消</Button>
              <Button type="primary" :loading="btnClick" @click="ok">确定</Button>
          </div>
    </Modal>
    <Modal :mask-closable="false" v-model="modal2" width="360" class-name="vertical-center-modal" @on-ok="remove(delID)">
        <p slot="header" style="color:#f60;text-align:center">
            <Icon type="ios-information-circle"></Icon>
            <span>确认删除</span>
        </p>
        <div style="text-align:center">
            <p>确认删除此数据么？</p>
        </div>
    </Modal>
    <!-- 新增弹窗结束 -->
    <Page show-total :total="total" :current="pageNo" :page-size='pageSize' show-elevator  @on-change='changePage' style="margin:20px auto;text-align:center"/>

     <Modal :mask-closable="false" v-model="modal0" width="1000" :footer-hide="true">
         <Table  border :columns="columns0" :data="tableData0"></Table>
          <Page show-total :total="total0" :page-size='pageSize0' show-elevator  @on-change='changePage0' style="margin:20px auto;text-align:center"/>
      </Modal>
  </div>
</template>

<script>
import axios from 'axios'

import {
  getTableData,
  getTableData0,
  add,
  update,
  del,
  getSelectOption,
  editTable,
  down
} from '@/api/unitFile'
import {getAllEqu} from '@/api/select'
export default {
  data () {
    return {
      btnClick:false,
      loading:true,
      delID: 0,
      modal0:false,
      modal2: false,
      pageNo: 1,
      pageSize: 10,
      total: 0,
      pageNo0: 1,
      pageSize0: 10,
      total0: 0,
      editState:false,
      loading1: false, // 文件类型加载框
      powerStationList: '',
      loading2: false, // 文件类型加载框
      HBnumberList: '',
      loading3: false, // 文件类型加载框
      JZnumberList: '',
       allEquList: [],
      allEquList2: [],
      modal1: false,
      title1: '',
      searchItem: {
        powerStation: '',
        hdNumber: '',
        aircrewNumber: '',
        type: '',
        gonglv: '',
        tyDate: ''
      },
      formItem: {
        id: '',
        powerStation: '',
        hdNumber: '',
        aircrewNumber: '',
        type: '',
        gonglv: '',
        tyDate: '',
        cyjType: '',
        cyjCode: '',
        cyjDate: '',
        cyjsccj: '',
        fdjType: '',
        fdjCode: '',
        fdjDate: '',
        fdjscch: '',
        admin: '',
        qigang: '',
        gangjing: '',
        rongji: '',
        yasuobi: '',
        edgl: '',
        bygl: '',
        yxgl: '',
        yxzj: '',
        edzs: '',
        ryxh: '',
        jyxh: '',
        fhdj: '',
        jydj: '',
        zjzl: '',
        jzwxcc: '',
        qdfs: '',
        lxfs: '',
        equipmentUuid: '',
        equipmentId: '',
        equipmentName: '',
        equipmentType: '',
        equipmentTypeName: '',
        erpcode: '',
        alarmStatus: '',
        alarmAlias: '',
        alarmId: '',
        monitorWay:3
      },
      columns: [
        {
          type: 'index',
          width: 60,
          title: '序号',
          align: 'center'
        },
        {
          title: '电站',
          key: 'powerStation'
        },
        {
          title: 'HD编号',
          key: 'hdNumber'
        },
        {
          title: '机组编号',
          key: 'aircrewNumber'
        },
        {
          title: '型号',
          key: 'type'
        },
        {
          title: '功率',
          key: 'gonglv'
        },
        {
          title: '投用日期',
          key: 'tyDate'
        },
        {
          title: '操作',
          key: 'action',
          width: 200,
          align: 'center',
          render: (h, params) => {
            return h('div', [
              h(
                'Button',
                {
                  props: {
                    type: 'success',
                    size: 'small'
                  },
                  style: {
                    marginRight: '5px'
                  },
                  on: {
                    click: () => {
                      this.detail(params.row.id, params.row.aircrewNumber)
                    }
                  }
                },
                '查看'
              ),
              h(
                'Button',
                {
                  props: {
                    type: 'primary',
                    size: 'small'
                  },
                  style: {
                    marginRight: '5px'
                  },
                  on: {
                    click: () => {
                      this.edit(JSON.stringify(params))
                    }
                  }
                },
                '编辑'
              ),
              h(
                'Button',
                {
                  props: {
                    type: 'error',
                    size: 'small'
                  },
                  on: {
                    click: () => {
                      this.openDel(params.row.id)
                    }
                  }
                },
                '删除'
              )
            ])
          }
        }
      ],
      tableData: [
        {
          powerStation: 'DDDHD',
          hdNumber: 'D1',
          aircrewNumber: 'D1LHP',
          type: '型号测试',
          gonglv: '100W',
          tyDate: '2016-10-03'
        },
        {
          powerStation: 'DDDHD',
          hdNumber: 'D1',
          aircrewNumber: 'D1LHP',
          type: '型号测试',
          gonglv: '100W',
          tyDate: '2016-10-03'
        }
      ],
      columns0: [
        {
          type: 'index',
          width: 60,
          title: '序号',
          align: 'center'
        },
        {
          title: '电站',
          key: 'powerStation'
        },
        {
          title: 'HD编号',
          key: 'hdNumber'
        },
        {
          title: '机组编号',
          key: 'aircrewNumber'
        },
        {
          title: '设备名称',
          key: 'equipmentTypeName'
        },
        {
          title: '类型',
          key: 'alarmAlias'
        },
        {
          title: '操作',
          key: 'action',
          width: 200,
          align: 'center',
          render: (h, params) => {
            return h('div', [
              h(
                'Button',
                {
                  props: {
                    type: 'error',
                    size: 'small',
                    disabled:params.row.addType==1
                  },
                  style: {
                  },
                  on: {
                    click: () => {
                      this.checkdata(JSON.stringify(params.row))
                    }
                  }
                },
                '选择'
              )
            ])
          }
        }
      ],
      tableData0: []
    }
  },
  methods: {
    download () {
      console.log('下载')
      let that = this
      let params = {
        pageNo: this.pageNo,
        pageSize: this.pageSize,
        powerStation: this.searchItem.powerStation,
        hdNumber: this.searchItem.hdNumber,
        aircrewNumber: this.searchItem.aircrewNumber,
        model: this.searchItem.type,
        rateOfWork: this.searchItem.gonglv,
        inServiceDate: this.searchItem.tyDate
      }
      down(params).then(res => {
      }).catch(err => {
        console.error('err>' + JSON.stringify(err))
      })
    },
    openDel (id) {
      this.modal2 = true
      this.delID = id
      // this.remove(params.index);
    },
    // 获取电站类型列表
    // powerStation () {
    //   getSelectOption(
    //     {
    //       code: 'dianzhan'
    //     }
    //   ).then(res => {
    //     this.powerStationList = res.data
    //   }).catch(err => {
    //     console.error('err>' + JSON.stringify(err))
    //   })
    // },
    // HBnumber () {
    //   getSelectOption(
    //     {
    //       code: 'hd_code'
    //     }
    //   ).then(res => {
    //     this.HBnumberList = res.data
    //   }).catch(err => {
    //     console.error('err>' + JSON.stringify(err))
    //   })
    // },
    // JZnumber () {
    //   getSelectOption(
    //     {
    //       code: 'jizu_code'
    //     }
    //   ).then(res => {
    //     this.JZnumberList = res.data
    //   }).catch(err => {
    //     console.error('err>' + JSON.stringify(err))
    //   })
    // },
    time (e) {
      this.searchItem.startInServiceDate = e[0];
      this.searchItem.endInServiceDate=e[1];
    },
    time1 (e) {
      console.log('e>' + e)
      this.formItem.time1 = e
    },
    time2 (e) {
      console.log('e>' + e)
      this.formItem.time2 = e
    },
    time3 (e) {
      console.log('e>' + e)
      this.formItem.time3 = e
    },
    remove (id) {
      del({ id: id }).then(res => {
        if (res.code == 0) {
          this.$Message.info('删除成功')
          this.pageNo=1
          this.getDataList()
        } else {
          this.$Message.info(res.message)
        }
      }).catch(err => {
        console.error('err>' + JSON.stringify(err))
      })
    },
    addData () {
      this.modal0=true;
      this.title1 = '新增机组文件'
      // this.modal1 = true;
      this.formItem={};
      this.editState=false;
      this.getDataList0();
    },
    checkdata(data){
      this.modal0=false;
      let data1=JSON.parse(data);
      this.modal1 = true;
      this.formItem.powerStation=data1.powerStation;
      this.formItem.hdNumber=data1.hdNumber;
      this.formItem.aircrewNumber=data1.aircrewNumber;
      this.formItem.equipmentUuid=data1.equipmentUuid
      this.formItem.equipmentId=data1.equipmentId
      this.formItem.equipmentName=data1.equipmentName
      this.formItem.equipmentType=data1.equipmentType
      this.formItem.equipmentTypeName=data1.equipmentTypeName
      this.formItem.erpcode=data1.erpcode
      this.formItem.alarmStatus=data1.alarmStatus
      this.formItem.alarmAlias=data1.alarmAlias
      this.formItem.alarmId=data1.alarmId
      this.formItem.monitorWay=3
    },
    detail (id, code) {
      console.log(id, '机组编号')
      this.$router.push({
        path: '/base/unitFileDetail',
        query: {
          id: id,
          code: code
        }
      })
    },
    edit (params) {
      this.title1 = '编辑机组文件'
      this.formItem = JSON.parse(params).row
      this.modal1 = true;
      this.editState=true;
    },
    ok () {
      this.btnClick=true;
      let params = {
        id: this.formItem.id,
        powerStation: this.formItem.powerStation,
        hdNumber: this.formItem.hdNumber,
        aircrewNumber: this.formItem.aircrewNumber,
        model: this.formItem.type,
        rateOfWork: this.formItem.gonglv,
        inServiceDate: this.formItem.time1,
        dieselModel: this.formItem.cyjType,
        dieselSeq: this.formItem.cyjCode,
        dieselLeaveFactoryDate: this.formItem.time2,
        dieselManufacturer: this.formItem.cyjsccj,
        dynamoModel: this.formItem.fdjType,
        dynamoSeq: this.formItem.fdjCode,
        dynamoLeaveFactoryDate: this.formItem.time3,
        dynamoManufacturer: this.formItem.fdjscch,
        manager: this.formItem.admin,
        cylinderStatorNumber: this.formItem.qigang,
        cylinderBore: this.formItem.gangjing,
        cylinderWorkingVolume: this.formItem.rongji,
        compressionRatio: this.formItem.yasuobi,
        ratedPower: this.formItem.edgl,
        standbyPower: this.formItem.bygl,
        effectivityPower: this.formItem.yxgl,
        effectiveTorque: this.formItem.yxzj,
        ratedSpeed: this.formItem.edzs,
        fuelConsumption: this.formItem.ryxh,
        oilConsumption: this.formItem.jyxh,
        levelOfProtection: this.formItem.fhdj,
        insulationGrade: this.formItem.jydj,
        netWeight: this.formItem.zjzl,
        dimensionWeight: this.formItem.jzwxcc,
        startingMode: this.formItem.qdfs,
        coolingMode: this.formItem.lxfs,
        equipmentUuid: this.formItem.equipmentUuid,
        equipmentId: this.formItem.equipmentId,
        equipmentName: this.formItem.equipmentName,
        equipmentType: this.formItem.equipmentType,
        equipmentTypeName: this.formItem.equipmentTypeName,
        erpcode: this.formItem.erpcode,
        alarmStatus: this.formItem.alarmStatus,
        alarmAlias: this.formItem.alarmAlias,
        alarmId: this.formItem.alarmId,
        monitorWay:this.formItem.monitorWay
      }
      if (this.title1 == '编辑机组文件') {
        editTable(params).then(res => {
          console.log(res)
          if (res.code == 0) {
            this.$Message.info('修改成功')
            this.getDataList()
            this.modal1=false;
            this.btnClick=false;
          } else {
            this.$Message.info(res.message)
            this.btnClick=false;
          }
        }).catch(err => {
          console.error('err>' + JSON.stringify(err))
        })
      }else{
        add(params).then(res => {
          console.log('res>' + JSON.stringify(res))
          if (res.code == 0) {
            this.$Message.info('新增成功')
            this.getDataList()
             this.modal1=false;
            this.btnClick=false;
          } else {
            this.$Message.info(res.message)
            this.btnClick=false;
          }
        }).catch(err => {
          console.error('err>' + JSON.stringify(err))
        })
      }
    },
    /** 分页 */
    changePage (pageNo) {
      this.pageNo = pageNo
      this.getDataList()
    },
    changePage0 (pageNo) {
      this.pageNo0 = pageNo
      this.getDataList0()
    },
    getDataList () {
      let params = {
        pageNo: this.pageNo,
        pageSize: this.pageSize,
        powerStation: this.searchItem.powerStation,
        hdNumber: this.searchItem.hdNumber,
        aircrewNumber: this.searchItem.aircrewNumber,
        model: this.searchItem.type,
        rateOfWork: this.searchItem.gonglv,
        startInServiceDate: this.searchItem.startInServiceDate,
        endInServiceDate:this.searchItem.endInServiceDate
      }

      getTableData(params).then(res => {
        console.log('res>' + JSON.stringify(res))
        if (res.code == 0) {
          this.loading=false;
          this.total = res.data.total
          let list = res.data.list
          this.tableData = list.map(item => {
            let it = {}
            it.id = item.id
            it.powerStation = item.powerStation
            it.hdNumber = item.hdNumber
            it.aircrewNumber = item.aircrewNumber
            it.type = item.model
            it.gonglv = item.rateOfWork
            it.tyDate = item.inServiceDate
            it.cyjType = item.dieselModel
            it.cyjCode = item.dieselSeq
            it.cyjDate = item.dieselLeaveFactoryDate
            it.cyjsccj = item.dieselManufacturer
            it.fdjType = item.dynamoModel
            it.fdjCode = item.dynamoSeq
            it.fdjDate = item.dynamoLeaveFactoryDate
            it.fdjscch = item.dynamoManufacturer
            it.admin = item.manager
            it.qigang = item.cylinderStatorNumber
            it.gangjing = item.cylinderBore
            it.rongji = item.cylinderWorkingVolume
            it.yasuobi = item.compressionRatio
            it.edgl = item.ratedPower
            it.bygl = item.standbyPower
            it.yxgl = item.effectivityPower
            it.yxzj = item.effectiveTorque
            it.edzs = item.ratedSpeed
            it.ryxh = item.fuelConsumption
            it.jyxh = item.oilConsumption
            it.fhdj = item.levelOfProtection
            it.jydj = item.insulationGrade
            it.zjzl = item.netWeight
            it.jzwxcc = item.dimensionWeight
            it.qdfs = item.startingMode
            it.lxfs = item.coolingMode

            it.time1 = item.inServiceDate
            it.time2 = item.dieselLeaveFactoryDate
            it.time3 = item.dynamoLeaveFactoryDate
            it.equipmentUuid = item.equipmentUuid
            it.equipmentId = item.equipmentId
            it.equipmentName = item.equipmentName
            it.equipmentType = item.equipmentType
            it.equipmentTypeName = item.equipmentTypeName
            it.erpcode = item.erpcode
            it.alarmStatus = item.alarmStatus
            it.alarmAlias = item.alarmAlias
            it.alarmId = item.alarmId
            it.monitorWay=item.monitorWay
            return it
          })

        }
      }).catch(err => {
        console.error('err>' + JSON.stringify(err))
      })
    },
    getDataList0 () {
      getTableData0({
         pageNo: this.pageNo0,
        pageSize: this.pageSize0
      }).then(res => {
        if (res.code == 0) {
          this.total0 = res.data.total
          this.tableData0 = res.data.list
        }
      }).catch(err => {
        console.error('err>' + JSON.stringify(err))
      })
    },

    getAllEqument() {
      getAllEqu(null).then(res => {
        this.allEquList = res.data;
        let arr = res.data.map(function(item) {
          return item.powerStation;
        });
        this.powerStationList = [...new Set(arr)];
      });
    },
    getHd(e) {
      this.JZnumberList = [];
      this.allEquList2 = this.allEquList.filter(item => item.powerStation == e);
      let arr2 = this.allEquList2.map(function(item) {
        return item.hdNumber;
      });
      this.HBnumberList = [...new Set(arr2)];
    },
    getJz(e) {
      let arr = this.allEquList2.filter(item => item.hdNumber == e);
      let arr2 = arr.map(function(item) {
        return item.aircrewNumber;
      });
      this.JZnumberList = [...new Set(arr2)];
    }
  },
  mounted () {},
  created () {
    this.getAllEqument();
    this.getDataList();
    this.getDataList0();
  }
}
</script>

<style lang="less">
.unitFile {
  background: #fff;
  height: 100%;
  padding: 15px;
  font-size: 14px;
  .searchDiv {
    .marRight {
      margin-right: 15px;
    }
  }
  .ivu-form-item {
    margin-bottom: 15px;
  }
}
.baseTitle {
    font-weight: bold;
    font-size:16px;
    margin-bottom:10px;
  }
 .xzjz  {
   .ivu-form-item {
    margin-bottom: 10px;
  }
 }

</style>
